package com.mrlv.ht.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mrlv.ht.mapper.DeptMapper;
import com.mrlv.ht.pojo.Dept;
import com.mrlv.ht.pojo.DeptExample;
import com.mrlv.ht.service.IDeptService;

@Service("deptService")
public class DeptServiceImpl implements IDeptService {

	@Resource
	private DeptMapper deptMapper;
	
	@Override
	public List<Dept> selectByExample(DeptExample example) {
		return deptMapper.selectByExample(example);
	}

	@Override
	public Dept selectByPrimaryKey(String deptId) {
		return deptMapper.selectByPrimaryKey(deptId);
	}

	@Override
	public List<Dept> findAllDept() {
		return deptMapper.findAllDept(); 
	}

	@Override
	public int insertSelective(Dept dept) {
		dept.setDeptId(UUID.randomUUID().toString());
		dept.setCreateTime(new Date());
		dept.setUpdateTime(dept.getCreateTime());
		dept.setState(new BigDecimal(1));
		return deptMapper.insertSelective(dept);
	}

	@Override
	public int updateByPrimaryKeySelective(Dept dept) {
		dept.setUpdateTime(new Date());
		return deptMapper.updateByPrimaryKeySelective(dept);
	}

	@Override
	public int deleteByPrimaryKey(String deptId) {
		return deptMapper.deleteByPrimaryKey(deptId);
	}

	@Override
	public int deleteBatch(String[] deptId) {
		return deptMapper.deleteBatch(deptId);
	}

	@Override
	public int updateBatch1(String[] deptId) {
		return deptMapper.updateBatch1(deptId);
	}

	@Override
	public int updateBatch0(String[] deptId) {
		return deptMapper.updateBatch0(deptId);
	}
}
